<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">
    <title>数据字典 - {$site.name}</title>
    <!-- Bootstrap Core CSS -->
    <link href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
    <!-- Custom CSS -->
    <!-- Plugin CSS -->
    <link href="https://cdn.staticfile.org/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">
    <link href="https://cdn.staticfile.org/simple-line-icons/2.4.1/css/simple-line-icons.min.css" rel="stylesheet">
    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!--[if lt IE 9]>
    <script src="https://cdn.staticfile.org/html5shiv/3.7.3/html5shiv.min.js"></script>
    <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
    <script src="https://cdn.staticfile.org/jquery/2.1.4/jquery.min.js"></script>
</head>
<body>
<style>
    .sidenav,
    .dictionary-container{overflow-y: auto; height: 100vh; }
    .sidenav .list-group{ padding: 20px 0}
    .side-nav-item{ margin-top: 10px; }
    .side-nav-item a{text-decoration: none; display: block;background: #f7f7f7;padding: 2px 15px;}
    .side-nav-item a:hover{ background: #f0f0f0}
    .side-nav-title{ font-size: 18px;}
    .side-nav-item .side-nav-table{ font-size: 16px;color: #565656; height: 26px; line-height: 26px; overflow: hidden;}
    .side-nav-item .side-nav-name{font-size: 14px;color: #9a9a9a;height: 22px; line-height: 22px; overflow: hidden;}
    .table-item { padding: 30px 30px 0 }
    .table-item h3{font-size: 24px; line-height: 30px;}
    .table-item h3 small{ font-size: 14px;line-height: 30px;}
    .table-desc{ background: #f5f5f5; padding: 0 10px; border-radius: 3px;}
    .table-info *{ border: none !important}
    .table-fields td{ word-break:break-all; word-wrap:break-word;}
</style>
<div id="content-container" class="container">
    <div class="row">
        <div class="col-md-3 sidenav">
            <div class="list-group">
                <dl>
                    <dt class="side-nav-title">插件创建的表</dt>
                    {foreach $dictionary['make'] as $k=>$v}
                    <dd class="side-nav-item"><a href="#{$v.table}">
                        <div class="side-nav-table">{$v.table}</div>
                        <div class="side-nav-name">{$v.name}</div>
                    </a></dd>
                    {/foreach}
                </dl>
                <dl>
                    <dt class="side-nav-title">FA系统表</dt>
                    {foreach $dictionary['system'] as $k=>$v}
                    <dd class="side-nav-item"><a href="#{$v.table}">
                        <div class="side-nav-table">{$v.table}</div>
                        <div class="side-nav-name">{$v.name}</div>
                    </a></dd>
                    {/foreach}
                </dl>
                <dl>
                    <dt class="side-nav-title">其他表</dt>
                    {foreach $dictionary['other'] as $k=>$v}
                    <dd class="side-nav-item"><a href="#{$v.table}">
                        <div class="side-nav-table">{$v.table}</div>
                        <div class="side-nav-name">{$v.name}</div>
                    </a></dd>
                    {/foreach}
                </dl>
            </div>
        </div>
        <div class="col-md-9 dictionary-container">
            <div class="panel panel-default">
                <div class="panel-body">
                    <h2 class="page-header">
                        数据字典
                    </h2>
                    <div class="row">
                        {foreach $dictionary as $type=>$tables}
                        {foreach $tables as $k=>$table}
                        <div id="{$table.table}" class="table-item">
                            <h3>{$table.table}（{$table.name}） <small class="pull-right">存储引擎：{$table.engine}；&nbsp;字符序：{$table.table_collation}</small></h3>
                            <div class="table-desc">
                                <table class="table table-info">
                                    <tr>
                                        <td style="text-align:right" width="15%">完整表名：</td>
                                        <td style="text-align: left" width="35%">{$table.table_name}</td>
                                        <td style="text-align:right" width="15%">创建时间：</td>
                                        <td style="text-align: left" width="35%">{$table.create_time}</td>
                                    </tr>
                                    <tr>

                                        {if $type=="make"&&$table.desc&&$table.desc!=$table.table_comment}
                                        <td style="text-align:right">描述说明：</td>
                                        <td style="text-align: left" colspan="3">{$table.desc}</td>
                                        {else}
                                        <td style="text-align:right">表备注：</td>
                                        <td style="text-align: left"  colspan="3">{$table.table_comment}</td>
                                        {/if}
                                    </tr>
                                </table>
                            </div>
                            <table class="table table-bordered table-hover table-fields">
                                <tr class="info">
                                    <th width="15%">字段名</th>
                                    <th width="15%">字段标题</th>
                                    <th width="20%">字段类型</th>
                                    <th width="10%">默认值</th>
                                    <th width="100">字段备注</th>
                                    {if $type=="make"}
                                    <th width="100">字段说明</th>
                                    {/if}
                                </tr>
                                {foreach $table['fields'] as $key=>$field}
                                <tr>
                                    <td>{$field.field_name}</td>
                                    <td>{$field.field_title}</td>
                                    <td>{$field.column_type}</td>
                                    <td>{$field.default}</td>
                                    <td>{$field.column_comment}</td>
                                    {if $type=="make"}
                                    <td>{$field.desc}</td>
                                    {/if}
                                </tr>
                                {/foreach}
                            </table>
                        </div>
                        {/foreach}
                        {/foreach}
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script src="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>
</body>
</html>